from app.Pojo.AdminUser import AdminUser



class AdminMapper:
    def __init__(self, db):
        self.db = db

    def get_by_phone(self, phone):
        """根据手机号获取管理员"""
        return AdminUser.query.filter_by(phone=phone).first()

    def update(self, admin):
        """更新管理员信息"""
        self.db.session.commit()
        return admin

    def get_by_id(self, id):
        """根据id获取管理员"""
        return AdminUser.query.filter_by(id=id).first()